package com.atguigu.inherited;

public class Teacher extends Person{//Teacher是Person的子类
    //这里故意先不私有化
    public double salary;

    //子类的无参构造
    public Teacher() {
        super();//调用父类的无参构造
    }

    //子类的有参构造
    public Teacher(String name, int age, char gender, double salary) {
        super(name, age, gender);//调用父类的有参构造
        this.salary = salary;
    }

    public void teach(){
        System.out.println("讲课");
    }

    public String getInfo(){
        return super.getInfo() +"，薪资：" + salary;
    }
}
